package com.kfm.base.anno;

import java.lang.reflect.Method;

public class Test {

    public static void main(String[] args) {
        Class<Demo02> demo02Class = Demo02.class;

        try {
            Method test = demo02Class.getMethod("test");

            log(test);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        }
    }


    public static void log(Method method){
        Log annotation = method.getAnnotation(Log.class);
        if (annotation != null){
            // 有 Log 注解
            String value = annotation.value();

            System.out.println(value);
        }
    }
}
